ci(release): build release notes from CHANGELOG; auto-populate PSData.ReleaseNotes; harden version expansion#31
Conversation
…pansion
Ports the ScheduledTasksManager release-tooling improvements into the template so
every module scaffolded from it inherits them.
- Create GitHub Release: extract the published version's section from CHANGELOG.md
and pass it via --notes-file (in pwsh), instead of --generate-notes. The latter
lists every merged PR since the last release tag, which between version bumps is
dominated by bot/CI/chore PRs and buries the actual user-facing changes. Includes
a Full Changelog compare link and falls back to --generate-notes if a version has
no changelog section (so a release is never blocked).
- Pass the version output via env (VERSION) in the 'Check if Release Exists',
'Check if PSGallery Version Exists', and 'Create GitHub Release' steps instead of
inlining ${{ steps.version.outputs.version }} into the run scripts. Inline
template expansion is substituted into the script text before the shell runs (a
template-injection vector zizmor/CodeRabbit flag); env vars are read at runtime.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
So a scaffolded module's PowerShell Gallery release-notes panel shows the curated, user-facing notes for each version (matching the GitHub release body) instead of a static CHANGELOG link. - build.depend.psd1: add ChangelogManagement 3.1.0 (Keep a Changelog parser). - build.psake.ps1: new UpdateReleaseNotes task (Depends Build) that reads the entry matching the module version via Get-ChangelogData and sets the built manifest's PrivateData.PSData.ReleaseNotes via Update-ModuleManifest. Wired in via $PSBPublishDependency so it runs before Publish-PSBuildModule. Non-fatal if the changelog can't be read or has no entry for the version. Mirrors the DSC Community Sampler pattern. Scaffolded modules use SemVer Keep a Changelog (CHANGELOG.template.md), the format this was validated against in ScheduledTasksManager. The template repo itself never runs this path (its publish is guarded against the un-initialized placeholder). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR integrates changelog-driven release notes into the module publishing pipeline. A new ChangelogManagement module dependency is added to support parsing CHANGELOG.md. A new UpdateReleaseNotes psake task extracts the matching version section and injects it into the built module manifest, executed during the build phase before publishing. The GitHub Actions workflow is updated to check release existence using an explicit VERSION variable and to generate release notes by parsing CHANGELOG.md, with fallback to automatic note generation if no matching section exists. ChangesChangelog-Driven Release Notes
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR ports release/publish tooling improvements into the template so scaffolded modules can (1) generate GitHub release bodies from the matching CHANGELOG.md section and (2) inject changelog-derived release notes into the built module manifest prior to publishing, while (3) avoiding inline ${{ }} expansions in workflow run: blocks by passing the version via environment variables.
Changes:
- Add a psake task to derive ReleaseNotes from
CHANGELOG.mdand update the built manifest before publishing. - Add
ChangelogManagementas a build dependency to parse Keep a Changelog formatted entries. - Update the publish workflow to build GitHub release notes from
CHANGELOG.md(with fallback) and harden version usage viaenv:.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| build.psake.ps1 | Adds UpdateReleaseNotes task and wires it into publish dependencies. |
| build.depend.psd1 | Adds ChangelogManagement dependency used to parse CHANGELOG.md. |
| .github/workflows/PublishModuleToPowerShellGallery.yaml | Uses env-provided VERSION and builds GitHub release notes from CHANGELOG.md with fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…view) Addresses Copilot review on #31: - UpdateReleaseNotes: if the matched CHANGELOG entry is empty/whitespace, warn and leave ReleaseNotes unchanged rather than overwriting the built manifest with an empty string. - Create GitHub Release: read CHANGELOG.md defensively (Test-Path + try/catch). A missing or unreadable file now falls back to --generate-notes instead of failing the publish (GitHub's pwsh runs with $ErrorActionPreference = 'Stop'). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/PublishModuleToPowerShellGallery.yaml:
- Around line 136-138: The $previousTag selection can return the current tag
causing the compare link to point to itself; update the assignment that sets
$previousTag (currently using git tag --list 'v*' --sort=-version:refname) to
exclude the current tag name "v$version" from the results (e.g., filter out
entries equal to "v$version" before Select-Object) so $previousTag always points
to the last other tag used when constructing the compare URL that uses
$previousTag and $version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d67d8c23-e95d-4fe0-99fe-9bf28645936e
📒 Files selected for processing (3)
.github/workflows/PublishModuleToPowerShellGallery.yamlbuild.depend.psd1build.psake.ps1
Addresses CodeRabbit review on #31: if a v$version tag already exists (e.g. a re-run, or a tag pushed without a release), the previous-tag selection could pick it and produce a self-referential Full Changelog compare link. Filter out "v$version" before selecting the most recent tag. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Ports the release-tooling improvements developed in ScheduledTasksManager into the template, so every module scaffolded from it inherits them. Three changes, all in the bundled build/publish files (no module/source changes).
1. GitHub release notes from
CHANGELOG.md(replaces--generate-notes)Create GitHub Releasenow extracts the published version's section fromCHANGELOG.mdand passes it via--notes-file(inpwsh).--generate-noteslists every merged PR since the last release tag — between version bumps that's dominated by dependabot/pre-commit/CI/chore PRs and buries the actual user-facing changes. Includes aFull Changelogcompare link and falls back to--generate-notesif a version has no changelog section (a release is never blocked).2. Auto-populate
PSData.ReleaseNotesat publish (PowerShell Gallery)build.depend.psd1: addChangelogManagement3.1.0.build.psake.ps1: newUpdateReleaseNotestask (-Depends 'Build') that reads the entry matching the module version viaGet-ChangelogDataand sets the built manifest'sPrivateData.PSData.ReleaseNotesviaUpdate-ModuleManifest. Wired in through$PSBPublishDependency = @('Test', 'UpdateReleaseNotes')so it runs beforePublish-PSBuildModule. Non-fatal if the changelog can't be read or lacks an entry for the version.So a scaffolded module's Gallery release-notes panel shows the same curated notes as its GitHub release, both sourced from
CHANGELOG.md.3. Harden version expansion in the publish workflow
Pass
${{ steps.version.outputs.version }}viaenv:(VERSION) in theCheck if Release Exists,Check if PSGallery Version Exists, andCreate GitHub Releasesteps instead of inlining it intorun:scripts. Inline template expansion is substituted into the script text before the shell runs (thetemplate-injectionclass zizmor/CodeRabbit flag); env vars are read at runtime. This removed all six inline expansions.Notes / verification
CHANGELOG.template.md→## [0.1.0], "adheres to Semantic Versioning"), the exact format validated end-to-end in ScheduledTasksManager. The template's own CalVerCHANGELOG.mdis only for the template repo, which never runs the publish path (guarded against the un-initialized placeholder).{{ModuleName}}manifest), so the publish-time path was validated in STM rather than here.${{ }}remain in anyrun:block body.Part of propagating these patterns to the ~6 existing template consumers (separate PRs to follow).
🤖 Generated with Claude Code
Summary by CodeRabbit